package cn.cloudtogo.common.types;

import lombok.Data;

/**
 * @author yaolianhua789@gmail.com
 **/
@Data
public class Result<T> {

    private T data;
    private String message;

    public Result(T data, String message) {
        this.data = data;
        this.message = message;
    }

    public Result(T data) {
        this.data = data;
    }

    public static <T> Result<T> of(T data) {
        return of(data, "success");
    }

    public static <T> Result<T> of(T data, String message) {
        return new Result<>(data, message);
    }

    public static Result<Void> of() {
        return of(null);
    }
}
